-
-
Notifications
You must be signed in to change notification settings - Fork 363
feat(Print): support cavas html element #6203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6203 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 704 704
Lines 31100 31100
Branches 4394 4394
=========================================
Hits 31100 31100
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Reviewer's GuideRefactored the PrintButton component to modularize print logic, hide the modal during printing, and add full support for rendering and restoring canvas elements by moving them into placeholders before print and back after. Sequence Diagram for Enhanced Print Process with Canvas SupportsequenceDiagram
actor User
participant PrintScript as "PrintButton.razor.js"
participant DOM
participant BrowserPrint as "Browser Print Service"
User->>PrintScript: Clicks PrintButton, triggers print(el)
PrintScript->>DOM: Hide associated modal
PrintScript->>PrintScript: Call createPrintContent(modalBody)
activate PrintScript
PrintScript->>DOM: Get canvas elements from modalBody
loop For each canvas in modalBody
PrintScript->>DOM: Create placeholder for canvas (via createCanvasPlaceholder)
PrintScript->>DOM: Move canvas to print view (via moveCanvas)
end
PrintScript->>DOM: Create printContainer with content & modified canvases
deactivate PrintScript
PrintScript->>DOM: Append printContainer to document body
PrintScript->>BrowserPrint: window.print()
BrowserPrint-->>User: Show Print Dialog
User-->>BrowserPrint: Interact with Print Dialog (Confirm/Cancel)
PrintScript->>PrintScript: Call restoreCanvas(printContainer)
activate PrintScript
loop For each canvas in printContainer
PrintScript->>DOM: Move canvas back to original DOM placeholder (via moveCanvas)
PrintScript->>DOM: Remove original DOM placeholder
end
deactivate PrintScript
PrintScript->>DOM: Remove printContainer from document body
PrintScript->>DOM: Show associated modal
Updated Class Diagram for PrintButton.razor.js ModuleclassDiagram
class PrintButtonModule {
<<JavaScript Module: PrintButton.razor.js>>
+init(id): void
+print(el): void
+createPrintContent(content): HTMLDivElement
+createCanvasPlaceholder(canvas: HTMLCanvasElement): void
+moveCanvas(canvas: HTMLCanvasElement, target: HTMLElement): void
+restoreCanvas(printContentEl: HTMLDivElement): void
+dispose(id): void
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Link issues
fixes #6202
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enable the PrintButton component to correctly render and print canvas elements by moving them into a temporary print container and restoring the original canvases after printing.
New Features:
Bug Fixes:
Enhancements: